package cn.hl.sfzy.service.impl;

import cn.hl.sfzy.entity.FM;
import cn.hl.sfzy.entity.Free;
import cn.hl.sfzy.mapper.FreeMapper;
import cn.hl.sfzy.service.FreeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName FreeServiceImpl
 * @Description TODO
 * @Author yangshen
 * @Date 2024年10月25日 11:38
 * @Version 1.0
 */
@Service
public class FreeServiceImpl implements FreeService {
    @Autowired
    private FreeMapper freeMapper;
    @Override
    public PageInfo find(Integer pageNum, Integer pageSize, Free free) {
        PageHelper.startPage(pageNum,pageSize);
        List<Free> frees = freeMapper.find(free);
        PageInfo<Free> fmPageInfo = new PageInfo<>(frees);
        return fmPageInfo;
    }

    @Override
    public int add(Free free) {
        return freeMapper.add(free);
    }

    @Override
    public int delete(long id) {
        return freeMapper.delete(id);
    }

    @Override
    public int update(Free free) {
        return freeMapper.update(free);
    }
}
